<template>
	<div class="layout-content index">
	    <Row>
	        <Col span="6">
	            <Card>
	            	<Row>
	            		<Col span="6">
	            			<Avatar icon="ios-person"  size="large" :src="$store.getters.admin.headImg" />
	            		</Col>
	            		<Col span="18" >
	            			<ul class="admin">
	            				<li>{{txtTime}}:{{$store.getters.admin.loginName}}</li>
	            				<li><Tag v-for="(name, index) in $store.getters.admin.roleName" :key="index">{{name}}</Tag></li>
	            			</ul>
	            		</Col>
	            	</Row>
	            </Card>
	        </Col>
	    </Row>
	</div>
</template>
<script>
	import {Card,Row,Col,Avatar,Tag} from 'view-design'

	export default {
		components:{
			Card,Row,Col,Avatar,Tag
	    },
		data () {
            return {
            	txtTime : '',
            }
        },
        methods:{
        	//显示时间区间
        	timeZoneShow(){
        		var now = new Date().getHours();
        		if (now<6) {
        			this.txtTime = '凌晨好';
        		}
        		if (now>=6 && now<11) {
        			this.txtTime = '上午好';
        		}
        		if (now>=11 && now<13) {
        			this.txtTime = '中午好';
        		}
        		if (now>=13 && now<18) {
        			this.txtTime = '下午好';
        		}
        		if (now>=18 && now<23) {
        			this.txtTime = '晚上好';
        		}
        	}
        },
		created: function () {
			this.$store.dispatch('GET_ADMIN_COMMON');
			this.$store.dispatch('CHANGE_ROUTE',{name:'首页',route:'/',action:1,closable:false});
			this.timeZoneShow();
        },
	}
</script>
<style>
	.index .admin{margin: 0px;list-style: none;}
</style>